﻿using RotovapPlatform.Domain.Business.Recipes.Entities;

namespace RotovapPlatform.Application.Services;

/// <summary>
/// 配方应用服务接口
/// </summary>
public interface IRecipeAppService
{
	/// <summary>
	/// 获取所有配方
	/// </summary>
	Task<IEnumerable<RecipeDefinition>> GetAllRecipesAsync();

	/// <summary>
	/// 根据ID获取配方
	/// </summary>
	Task<RecipeDefinition> GetRecipeByIdAsync(Guid recipeId);

	/// <summary>
	/// 创建配方
	/// </summary>
	Task<(bool Success, string Message, Guid? RecipeId)> CreateRecipeAsync(RecipeDefinition recipe);

	/// <summary>
	/// 更新配方
	/// </summary>
	Task<(bool Success, string Message)> UpdateRecipeAsync(RecipeDefinition recipe);

	/// <summary>
	/// 删除配方
	/// </summary>
	Task<(bool Success, string Message)> DeleteRecipeAsync(Guid recipeId);

	/// <summary>
	/// 复制配方
	/// </summary>
	Task<(bool Success, string Message, Guid? RecipeId)> CloneRecipeAsync(Guid sourceRecipeId);

	/// <summary>
	/// 验证配方
	/// </summary>
	/// <param name="recipe">待验证的配方</param>
	/// <returns>验证结果和错误信息</returns>
	Task<(bool IsValid, string ErrorMessage)> ValidateRecipeAsync(RecipeDefinition recipe);

	/// <summary>
	/// 验证配方参数是否在设备工艺参数的合理范围内
	/// </summary>
	/// <param name="recipe">待验证的配方</param>
	/// <returns>验证结果和错误信息</returns>
	Task<(bool IsValid, string ErrorMessage)> ValidateParameterRangesAsync(RecipeDefinition recipe);

	/// <summary>
	/// 验证物料和清洗液是否存在
	/// </summary>
	/// <param name="recipe">待验证的配方</param>
	/// <returns>验证结果和错误信息</returns>
	Task<(bool IsValid, string ErrorMessage)> ValidateMaterialsExistenceAsync(RecipeDefinition recipe);

	/// <summary>
	/// 获取所有实验组
	/// </summary>
	Task<IEnumerable<ExperimentGroup>> GetAllExperimentGroupsAsync();

	/// <summary>
	/// 创建实验组
	/// </summary>
	Task<(bool Success, string Message, Guid? GroupId)> CreateExperimentGroupAsync(ExperimentGroup group);

	/// <summary>
	/// 更新实验组
	/// </summary>
	Task<(bool Success, string Message)> UpdateExperimentGroupAsync(ExperimentGroup group);

	/// <summary>
	/// 删除实验组
	/// </summary>
	Task<(bool Success, string Message)> DeleteExperimentGroupAsync(Guid groupId);

	/// <summary>
	/// 添加配方到实验组
	/// </summary>
	Task<(bool Success, string Message)> AddRecipeToGroupAsync(Guid groupId, Guid recipeId);

	
}